package com.nacrtstudio.webgiftshop.pages.admin;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.nacrtstudio.webgiftshop.facade.Controller;
import com.nacrtstudio.webgiftshop.model.website.QandA;
import com.nacrtstudio.webgiftshop.model.website.beans.QandABean;

@RequiresRoles("admin")
public class EditInstructions {
	@Inject
	@Property
	private Controller controller;
	@Property
	private QandA qandA;
	
	@Property
	private String question;
	@Property
	private String answer;
	
	@InjectComponent
	private Form form;
	
	public void onSubmitFromForm(){
		try {
			controller.saveQandA(question, answer);
		} catch (Exception e) {
			// TODO: handle exception
		}
		
	}
}
